using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
namespace CoreData
{
    public class work
    {
            public long id{get;set;}
            public string name{get;set;}
            public string description{get;set;}
            public string image{get;set;}
            public int price{get;set;}
            public DateTime createdate{get;set;}
            public DateTime modifieddate{get;set;}
            public long userid{get;set;}
            public int type{get;set;}
            public int status{get;set;}
            public string lockreason{get;set;}
            public int jobid{get;set;}
            public long view{get;set;}
            public long sole{get;set;}
            public string link{get;set;}
            public bool active{get;set;}
            public string title{get;set;}
            public string metakeyword{get;set;}
            public string metadescription{get;set;}
         
        public work()
        {       
                    name ="";   
                    description ="";   
                    image ="";   
                    lockreason ="";   
                    link ="";   
                    title ="";   
                    metakeyword ="";   
                    metadescription ="";   
        }
        
       static work DynamicCast<T>(object row_data, object row_header) where T : work
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           work ret = new work();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "id":
                        ret.id = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "name":
                        ret.name = ConvertObject.ToString(dt[column]);
                       break;
                      case  "description":
                        ret.description = ConvertObject.ToString(dt[column]);
                       break;
                      case  "image":
                        ret.image = ConvertObject.ToString(dt[column]);
                       break;
                      case  "price":
                        ret.price = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "createdate":
                        ret.createdate = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "modifieddate":
                        ret.modifieddate = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "userid":
                        ret.userid = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "type":
                        ret.type = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "status":
                        ret.status = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "lockreason":
                        ret.lockreason = ConvertObject.ToString(dt[column]);
                       break;
                      case  "jobid":
                        ret.jobid = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "view":
                        ret.view = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "sole":
                        ret.sole = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "link":
                        ret.link = ConvertObject.ToString(dt[column]);
                       break;
                      case  "active":
                        ret.active = ConvertObject.ToBool(dt[column]);
                       break;
                      case  "title":
                        ret.title = ConvertObject.ToString(dt[column]);
                       break;
                      case  "metakeyword":
                        ret.metakeyword = ConvertObject.ToString(dt[column]);
                       break;
                      case  "metadescription":
                        ret.metadescription = ConvertObject.ToString(dt[column]);
                       break;
                
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
